Declarations of new types : Union
Pascal
C/C++
union borrower
{
employee EBorr;
student SBorr;
} borrower;
union borrower someone;
OR
w
type
w
borrower = record
w
case boolean of
w
false: (EBorr: employee);
w
true: (SBorr: student)
w
end;
w
var
w
someone: borrower;
Example:
Suppose the types employee and
student have been previously declared: